#ifndef PROTO_CDDB_H
#define PROTO_CDDB_H

#include "proto.h"
#include "discinfo.h"
#include "connection.h"

class ProtoCddb : public Proto
{
	public:
		ProtoCddb();
		~ProtoCddb();
		bool checkScheme(const std::string scheme);
		bool fillDiscData(const uri_t uri, disc_t& data);

	private:
		Connection connection;

		struct Response
		{
			std::string code;
			std::string head;
			std::string body;
		};

		bool connect(const uri_t uri);
		Response command(const char* command);
		Response command(const std::string command);
		Response parse(const std::string response);

		disc_t readCddbEntry(std::string& data, const disc_t& info);
};

#endif /* PROTO_CDDB_H */
